<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/webpage/include/taglib.jsp"%>
<html>
<head>
	<title>运输计划管理</title>
	<meta name="decorator" content="ani"/>
	<script type="text/javascript">
		var validateForm;
		var $table; // 父页面table表格id
		var $topIndex;//弹出窗口的 index
		function doSubmit(table, index){//回调函数，在编辑和保存动作时，供openDialog调用提交表单。
		  if(validateForm.form()){
			  $table = table;
			  $topIndex = index;
			  jp.loading();
			  $("#inputForm").submit();
			  return true;
		  }

		  return false;
		}

		$(document).ready(function() {
			validateForm = $("#inputForm").validate({
				submitHandler: function(form){
					jp.post("${ctx}/tms/newTransport/save",$('#inputForm').serialize(),function(data){
						if(data.success){
	                    	$table.bootstrapTable('refresh');
	                    	jp.success(data.msg);
	                    	jp.close($topIndex);//关闭dialog

	                    }else{
            	  			jp.error(data.msg);
	                    }
					})
				},
				errorContainer: "#messageBox",
				errorPlacement: function(error, element) {
					$("#messageBox").text("输入有误，请先更正。");
					if (element.is(":checkbox")||element.is(":radio")||element.parent().is(".input-append")){
						error.appendTo(element.parent().parent());
					} else {
						error.insertAfter(element);
					}
				}
			});
			
		});
	</script>
</head>
<body class="bg-white">
		<form:form id="inputForm" modelAttribute="newTransport" class="form-horizontal">
		<form:hidden path="id"/>
		<sys:message content="${message}"/>
			<ul class="nav nav-tabs">
				<li class="active"><a data-toggle="tab" href="#tab-01" aria-expanded="true">订单详情</a>
				</li>
				<li class=""><a data-toggle="tab" href="#tab-02" aria-expanded="true">服务信息</a>
				</li>
				<li class=""><a data-toggle="tab" href="#tab-03" aria-expanded="true">分配明细</a>
				</li>

			</ul>
		<div class="tab-content">
			<div id="tab-01" class="tab-pane fade in active">
				<table class="table table-bordered">

				<tr>
					<td class="width-10 active"><label class="pull-right">委托单状态：</label></td>
					<td class="width-23">
						<form:input path="status" htmlEscape="false"    class="form-control "/>
					</td>
					<td class="width-10 active"><label class="pull-right">计划状态：</label></td>
					<td class="width-23">
						<form:input path="jhstatus" htmlEscape="false"    class="form-control "/>
					</td>
					<td class="width-10 active"><label class="pull-right">委托单号：</label></td>
					<td class="width-23">
						<form:input path="wtdh" htmlEscape="false"    class="form-control "/>
					</td>
				</tr>
				<tr>
					<td class="width-10 active"><label class="pull-right">下单日期：</label></td>
					<td class="width-23">
						<input type='text'  name="date" class="form-control"  value="<fmt:formatDate value="${newTransport.date}" pattern="yyyy-MM-dd"/>"/>

						<%--<form:input path="date" htmlEscape="false"    class="form-control "/>--%>
					</td>
					<td class="width-10 active"><label class="pull-right">装运单号：</label></td>
					<td class="width-23">
						<form:input path="zydh" htmlEscape="false"    class="form-control "/>
					</td>

					<td class="width-10 active"><label class="pull-right">提货单号：</label></td>
					<td class="width-23">
						<form:input path="thdh" htmlEscape="false"    class="form-control "/>
					</td>

				</tr>
				<tr>
					<td class="width-10 active"><label class="pull-right">物料编码：</label></td>
					<td class="width-23">
						<form:input path="code" htmlEscape="false"    class="form-control "/>
					</td>
					<td class="width-10 active"><label class="pull-right">物料名称：</label></td>
					<td class="width-23">
						<form:input path="name.name" htmlEscape="false"    class="form-control "/>
					</td>
					<td class="width-10 active"><label class="pull-right">规格：</label></td>
					<td class="width-23">
						<form:input path="gg" htmlEscape="false"    class="form-control "/>
					</td>
				</tr>
				<tr>
					<td class="width-10 active"><label class="pull-right">物料类型：</label></td>
					<td class="width-23">
						<form:input path="lx" htmlEscape="false"    class="form-control "/>
					</td>
					<td class="width-10 active"><label class="pull-right">单位：</label></td>
					<td class="width-23">
						<form:input path="unit" htmlEscape="false"    class="form-control "/>
					</td>
					<td class="width-10 active"><label class="pull-right">毛重：</label></td>
					<td class="width-23">
						<form:input path="weight" htmlEscape="false"    class="form-control "/>
					</td>

				</tr>
				<tr>
					<td class="width-10 active"><label class="pull-right">体积：</label></td>
					<td class="width-23">
						<form:input path="voulm" htmlEscape="false"    class="form-control "/>
					</td>
					<td class="width-10 active"><label class="pull-right">计划量：</label></td>
					<td class="width-23">
						<form:input path="gross" htmlEscape="false"    class="form-control "/>
					</td>
					<td class="width-10 active"><label class="pull-right">派车量：</label></td>
					<td class="width-23">
						<form:input path="pcl" htmlEscape="false"    class="form-control "/>
					</td>


				</tr>
				<tr>
					<td class="width-10 active"><label class="pull-right">已发：</label></td>
					<td class="width-23">
						<form:input path="yf" htmlEscape="false"    class="form-control "/>
					</td>
					<td class="width-10 active"><label class="pull-right">未发：</label></td>
					<td class="width-23">
						<form:input path="wf" htmlEscape="false"    class="form-control "/>
					</td>
					<td class="width-10 active"><label class="pull-right">提货仓库：</label></td>
					<td class="width-23">
						<form:input path="deop.store" htmlEscape="false"    class="form-control "/>
					</td>
				</tr>
				<tr>

					<td class="width-10 active"><label class="pull-right">订单类型：</label></td>
					<td class="width-23">
						<form:input path="type" htmlEscape="false"    class="form-control "/>
					</td>

					<td class="width-10 active"><label class="pull-right">要求发货日期：</label></td>
					<td class="width-23">
						<input type='text'  name="fhdate" class="form-control"  value="<fmt:formatDate value="${newTransport.fhdate}" pattern="yyyy-MM-dd"/>"/>

						<%--<form:input path="fhdate" htmlEscape="false"    class="form-control "/>--%>
					</td>
					<td class="width-10 active"><label class="pull-right">要求到货日期：</label></td>
					<td class="width-23">
						<input type='text'  name="dhdate" class="form-control"  value="<fmt:formatDate value="${newTransport.dhdate}" pattern="yyyy-MM-dd"/>"/>

						<%--<form:input path="dhdate" htmlEscape="false"    class="form-control "/>--%>
					</td>
				</tr>
				<tr>
					<td class="width-10 active"><label class="pull-right">收货详细地址：</label></td>
					<td class="width-23">
						<form:input path="site" htmlEscape="false"    class="form-control "/>
					</td>
					<td class="width-10 active"><label class="pull-right">起运地：</label></td>
					<td class="width-23">
						<form:input path="qyd.name" htmlEscape="false"    class="form-control "/>
					</td>
					<td class="width-10 active"><label class="pull-right">结算地：</label></td>
					<td class="width-23">
						<form:input path="jsd.name" htmlEscape="false"    class="form-control "/>
					</td>

				</tr>
				<tr>
					<td class="width-10 active"><label class="pull-right">到站省：</label></td>
					<td class="width-23">
						<form:input path="dzs" htmlEscape="false"    class="form-control "/>
					</td>
					<td class="width-10 active"><label class="pull-right">到站地城市：</label></td>
					<td class="width-23">
						<form:input path="dzdcs" htmlEscape="false"    class="form-control "/>
					</td>
					<td class="width-10 active"><label class="pull-right">合同里程：</label></td>
					<td class="width-23">
						<form:input path="htlc" htmlEscape="false"    class="form-control "/>
					</td>
				</tr>

				<tr>
					<td class="width-10 active"><label class="pull-right">收货单位：</label></td>
					<td class="width-23">
						<form:input path="shdw" htmlEscape="false"    class="form-control "/>
					</td>
					<td class="width-10 active"><label class="pull-right">收货单位确认人：</label></td>
					<td class="width-23">
						<form:input path="qrr" htmlEscape="false"    class="form-control "/>
					</td>

					<td class="width-10 active"><label class="pull-right">确认人电话：</label></td>
					<td class="width-23">
						<form:input path="qrrdh" htmlEscape="false"    class="form-control "/>
					</td>

				</tr>
					<tr>

						<td class="width-15 active"><label class="pull-right">客户特殊需求：</label></td>
						<td class="width-85" colspan="5">
							<form:input path="khtstq" htmlEscape="false"    class="form-control "/>
						</td>
					</tr>
					<tr>
						<td class="width-15 active"><label class="pull-right">备注信息：</label></td>
						<td class="width-85" colspan="5">
							<form:textarea path="remarks" htmlEscape="false" rows="4"    class="form-control "/>
						</td>

					</tr>
				</table>
			</div>
			<div id="tab-02" class="tab-pane fade">
				<table class="table table-bordered">
					<tbody>

					<tr>
						<td class="width-15 active"><label class="pull-right">运输线路：</label></td>
						<td class="width-35">
							<form:input path="ysxl" htmlEscape="false"    class="form-control "/>
						</td>
						<td class="width-15 active"><label class="pull-right">运输方式：</label></td>
						<td class="width-35">
							<form:input path="ysfs" htmlEscape="false"    class="form-control "/>
						</td>
					</tr>
					<tr>
						<td class="width-15 active"><label class="pull-right">结算方式：</label></td>
						<td class="width-35">
							<form:input path="jsfs" htmlEscape="false"    class="form-control "/>
						</td>
						<td class="width-15 active"><label class="pull-right">结算类型：</label></td>
						<td class="width-35">
							<form:input path="jslx" htmlEscape="false"    class="form-control "/>
						</td>
					</tr>
					<tr>
						<td class="width-15 active"><label class="pull-right">结算吨位区间：</label></td>
						<td class="width-35">
							<form:input path="width" htmlEscape="false"    class="form-control "/>
						</td>
						<td class="width-15 active"><label class="pull-right">作业类型：</label></td>
						<td class="width-35">
							<form:input path="zylx" htmlEscape="false"    class="form-control "/>
						</td>
					</tr>
					<tr>
						<td class="width-15 active"><label class="pull-right">客户Id：</label></td>
						<td class="width-35">
							<form:input path="customer" htmlEscape="false"    class="form-control "/>
						</td>
						<td class="width-15 active"><label class="pull-right">项目：</label></td>
						<td class="width-35">
							<form:input path="pro" htmlEscape="false"    class="form-control "/>
						</td>
					</tr>
					</tbody>
				</table>

			</div>
			<div id="tab-03" class="tab-pane fade">

				<table class="table table-bordered">
					<tr>
						<th>序号</th>
						<th>运单号</th>
						<th>车牌号</th>
						<th>运单状态</th>
						<th>运输线路</th>
						<th>提货单号</th>
						<th>物料名称</th>
						<th>派车量</th>
						<th>装车量</th>
						<th>毛重</th>
						<th>提货仓库</th>
					</tr>
					<c:forEach var="bill" items="${list}"  varStatus="index">

								<tr>
									<td>${index.index+1}</td>
									<td>${bill.ydh}</td>
									<td>${bill.cph}</td>
									<td>${bill.status}</td>
									<td>${bill.ysxl}</td>
									<td>${bill.thdh}</td>
									<td>${bill.name.name}</td>
									<td>${bill.pcl}</td>
									<td>${bill.zcl}</td>
									<td>${bill.weight}</td>
									<td>${bill.deop.store}</td>
								</tr>


					</c:forEach>
				</table>
			</div>
		</div>
	</form:form>
</body>
</html>